home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / dview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-06  |  2.6 KB  |  112 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1989, Tera Computer Company
  5.  **/
  6.  
  7.   /* View of the built-in attribute indicator */
  8.  
  9. #ifndef dview_h
  10. #define dview_h
  11.  
  12. #include <InterViews/interactor.h>
  13. #include <InterViews/button.h>
  14. #include <InterViews/box.h>
  15. #include <InterViews/message.h>
  16. #include <InterViews/painter.h>
  17. #include "att.h"
  18.  
  19. class Button;
  20. class PushButton;
  21. class Painter;
  22. class CycleButton;
  23. class DrawView;
  24. class Depiction;
  25.  
  26. // A message indicating an attribute value plus a button to press to change the
  27. // message.  The message 'cycles' betwen various attribute values, forward or
  28. // backward, or can be reset to the base value
  29.  
  30. class CycleParam : public HBox
  31. {
  32. public:
  33.     CycleParam (char*, char*, DrawView*, AttType);
  34.     void ChangeText(char*);
  35.     void cycle(boolean);
  36.     void reset();
  37. private:
  38.     CycleButton* button;
  39.     Message* message;
  40.     char* text;
  41.     DrawView* dv;
  42.     AttType type;    // shape, color, or brush?
  43. };
  44.  
  45. // The interactive button in a CycleParam
  46.  
  47. class CycleButton : public PushButton
  48. {
  49. public:
  50.     CycleButton(char*, ButtonState*, CycleParam*);
  51.     void Handle(Event&);
  52. private:
  53.     CycleParam* cp;
  54. };
  55.  
  56. // The drawing indicating the current values of the built-in attributes
  57.  
  58. class Depiction : public Interactor
  59. {
  60. public:
  61.     Depiction::Depiction();
  62.     void Draw();
  63.     void Redraw(Coord, Coord, Coord, Coord);
  64.     void inhibit() { okaytodraw = false; };
  65.     void allow() { okaytodraw = true; };
  66.  
  67.     NShape currShape;
  68.     Painter *painter;
  69. private:
  70.     friend class DrawView;
  71.  
  72.     boolean okaytodraw;
  73. };
  74.  
  75. // 3 cycleparams, plus a depiction of what they mean
  76.  
  77. class DrawView : public VBox
  78. {
  79. public:
  80.     DrawView(int);
  81.     void cycle(char*, boolean, AttType);
  82.     void reset(AttType);
  83.     void Draw();
  84.     void Redraw(Coord, Coord, Coord, Coord);
  85.     void Update();
  86.     void Resize();
  87.     boolean ShapeSet() { return shapeset; };
  88.     boolean ColorSet() { return colorset; };
  89.     boolean BrushSet() { return brushset; };
  90.     NShape CurShape() { return depiction->currShape; };
  91.     BType CurBrush() { return currentBrush; };
  92.     CType CurColor() { return currentColor; };
  93.     void DrawDep ();
  94. private:
  95.     Depiction *depiction;
  96.     CType currentColor;
  97.     BType currentBrush;
  98.     boolean colorset;        // is there a current color?
  99.     boolean brushset;        // is there a current brush?
  100.     boolean shapeset;        // is there a current shape?
  101.     CycleParam *colorButton;
  102.     CycleParam *brushButton;
  103.     CycleParam *shapeButton;
  104.     void EraseDep ();
  105.     int size;            // size it should be
  106.     char* colorString();
  107.     char* shapeString();
  108.     char* brushString();
  109. };
  110.  
  111. #endif
  112.